cmake_minimum_required(VERSION 3.0.2)
project(ros_mpc)
set(CMAKE_CXX_STANDARD 11)

## 寻找依赖包
find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs message_generation custom_msgs)
find_package(Python2 COMPONENTS Development NumPy)  #绘图库matplotlib-cpp所需

## 声明catkin包的依赖
catkin_package(CATKIN_DEPENDS roscpp rospy std_msgs message_runtime)

## 添加头文件路径
include_directories(include ${catkin_INCLUDE_DIRS})
include_directories(../../../devel/include) #include mpc.h
include_directories(${CMAKE_SOURCE_DIR}/include)
include_directories(/usr/local/include)     #包含系统头文件库
link_directories(/usr/local/include)        #包含系统的库文件

## 生成可执行文件
add_executable(n_mpc_controller src/n_mpc_controller.cpp
                                src/mpc_controller.cpp
                                src/path_plan.cpp)
## 添加依赖项
add_dependencies(n_mpc_controller custom_msgs_gencpp)   #让custom_msgs包先编译
add_dependencies(n_mpc_controller ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

## 链接库
target_include_directories(n_mpc_controller PRIVATE ${Python2_INCLUDE_DIRS}
                                                   ${Python2_NumPy_INCLUDE_DIRS})
target_link_libraries(n_mpc_controller ${catkin_LIBRARIES} Python2::Python Python2::NumPy ipopt)

